import com.sun.org.apache.bcel.internal.generic.ANEWARRAY;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class t119 {
    public static void main(String[] args) {
        int n = 3;
        System.out.println(getRow(n));
    }
    public static List<Integer> getRow(int rowIndex) {
        int dp[][] = new int[2][];
        rowIndex++;
        List<Integer> list = new ArrayList<>();
        for (int i = 1; i <= rowIndex; i++) {
            dp[(i-1)%2] = new int[i];
            if(i!=rowIndex)
            for (int j = 0; j < i; j++) {
                if(j==0||j==i-1) dp[(i-1)%2][j] = 1;
                else dp[(i-1)%2][j] = dp[i%2][j]+dp[i%2][j-1];
            }
            else
            for (int j = 0; j < i; j++) {
                if(j==0||j==i-1){
                    list.add(1);
                }else{
                    list.add(dp[i%2][j]+dp[i%2][j-1]);
                }
            }
        }
        return list;
    }
}
